import { defineConfig } from 'umi';
import { resolve } from "path";

export default {
  // open mock
  mock: {},
  base: '/',
  // 按需加载
  dynamicImport: {
    loading: '@/components/loading/index.tsx'
  },
  // 文件 hash
  hash: true,
  // 路由 hash
  history: { type: 'hash' },
  alias: {
    "@": resolve(__dirname, "../src"),
    '@utils': resolve(__dirname, "../src/utils"),
    // 组件库
    '@components': resolve(__dirname, "../src/components"),
    // 全局services
    '@services': resolve(__dirname, "../src/services/api.tsx"),
    // 全局models
    '@models': resolve(__dirname, "../src/models"),
    // request请求
    "@http": resolve(__dirname, '../src/utils/request.js')
  },
  proxy: {
    '/api': {
      target: 'https://carpool.shanch.cn',
      pathRewrite: { '^/api': '/api' },
      changeOrigin: true,
    },
  },
}
